﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Mjesto typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class MjestoDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<MjestoDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Mjesto _currentMjesto = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxMjestoDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxMjestoErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxMjestoBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PostanskiBroj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPostanskiBrojDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SifraOpcine property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSifraOpcineDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Prirez property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrirezDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ZiroRacunZaPorezPrirez property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxZiroRacunZaPorezPrirezDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the TipMjesta property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxTipMjestaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDNadMjesto property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDNadMjestoDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Hierarchy property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxHierarchyDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Lvl property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxLvlDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SifraOpcineRegos property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSifraOpcineRegosDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Mjesto> _IDNadMjestoList;
		
		/// <summary> 
		/// The list of selectable Mjesto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Mjesto> IDNadMjestoList
		{
			get {return this._IDNadMjestoList;}
			set 
			{
				this._IDNadMjestoList = value;
				this.uxIDNadMjestoDataGridViewColumn.DataSource = null;
				this.uxIDNadMjestoDataGridViewColumn.DataSource = this._IDNadMjestoList;
			}
		}
		
		private bool _allowNewItemInIDNadMjestoList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Mjesto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDNadMjestoList
		{
			get { return _allowNewItemInIDNadMjestoList;}
			set
			{
				this._allowNewItemInIDNadMjestoList = value;
				this.uxIDNadMjestoDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.MjestoTip> _TipMjestaList;
		
		/// <summary> 
		/// The list of selectable MjestoTip
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.MjestoTip> TipMjestaList
		{
			get {return this._TipMjestaList;}
			set 
			{
				this._TipMjestaList = value;
				this.uxTipMjestaDataGridViewColumn.DataSource = null;
				this.uxTipMjestaDataGridViewColumn.DataSource = this._TipMjestaList;
			}
		}
		
		private bool _allowNewItemInTipMjestaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of MjestoTip
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInTipMjestaList
		{
			get { return _allowNewItemInTipMjestaList;}
			set
			{
				this._allowNewItemInTipMjestaList = value;
				this.uxTipMjestaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Mjesto> _MjestoList;
				
		/// <summary> 
		/// The list of Mjesto to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Mjesto> MjestoList
		{
			get {return this._MjestoList;}
			set
			{
				this._MjestoList = value;
				this.uxMjestoBindingSource.DataSource = null;
				this.uxMjestoBindingSource.DataSource = value;
				this.uxMjestoDataGridView.DataSource = null;
				this.uxMjestoDataGridView.DataSource = this.uxMjestoBindingSource;				
				//this.uxMjestoBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxMjestoBindingSource_ListChanged);
				this.uxMjestoBindingSource.CurrentItemChanged += new System.EventHandler(OnMjestoBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnMjestoBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentMjesto = uxMjestoBindingSource.Current as Entities.Mjesto;
			
			if (_currentMjesto != null)
			{
				_currentMjesto.Validate();
			}
			//_Mjesto.Validate();
			OnCurrentEntityChanged();
		}

		//void uxMjestoBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Mjesto"/> instance.
		/// </summary>
		public Entities.Mjesto SelectedMjesto
		{
			get {return this._currentMjesto;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxMjestoDataGridView.VirtualMode;}
			set
			{
				this.uxMjestoDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxMjestoDataGridView.AllowUserToAddRows;}
			set {this.uxMjestoDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxMjestoDataGridView.AllowUserToDeleteRows;}
			set {this.uxMjestoDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxMjestoDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxMjestoDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="MjestoDataGridViewBase"/> class.
		/// </summary>
		public MjestoDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxMjestoDataGridView = new System.Windows.Forms.DataGridView();
			this.uxMjestoBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxMjestoErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPostanskiBrojDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSifraOpcineDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrirezDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTipMjestaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDNadMjestoDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxHierarchyDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxLvlDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSifraOpcineRegosDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDNadMjestoBindingSource = new MjestoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNadMjestoBindingSource)).BeginInit();
			//this.uxTipMjestaBindingSource = new MjestoTipBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxTipMjestaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxMjestoErrorProvider
			// 
			this.uxMjestoErrorProvider.ContainerControl = this;
			this.uxMjestoErrorProvider.DataSource = this.uxMjestoBindingSource;						
			// 
			// uxMjestoDataGridView
			// 
			this.uxMjestoDataGridView.AutoGenerateColumns = false;
			this.uxMjestoDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxMjestoDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxPostanskiBrojDataGridViewColumn,
		this.uxSifraOpcineDataGridViewColumn,
		this.uxPrirezDataGridViewColumn,
		this.uxZiroRacunZaPorezPrirezDataGridViewColumn,
		this.uxTipMjestaDataGridViewColumn,
		this.uxIDNadMjestoDataGridViewColumn,
		this.uxHierarchyDataGridViewColumn,
		this.uxLvlDataGridViewColumn,
		this.uxSifraOpcineRegosDataGridViewColumn			});
			this.uxMjestoDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxMjestoDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxMjestoDataGridView.Name = "uxMjestoDataGridView";
			this.uxMjestoDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxMjestoDataGridView.TabIndex = 0;	
			this.uxMjestoDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxMjestoDataGridView.EnableHeadersVisualStyles = false;
			this.uxMjestoDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnMjestoDataGridViewDataError);
			this.uxMjestoDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnMjestoDataGridViewCellValueNeeded);
			this.uxMjestoDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnMjestoDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxPostanskiBrojDataGridViewColumn
			//
			this.uxPostanskiBrojDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPostanskiBrojDataGridViewColumn.DataPropertyName = "PostanskiBroj";
			this.uxPostanskiBrojDataGridViewColumn.HeaderText = "PostanskiBroj";
			this.uxPostanskiBrojDataGridViewColumn.Name = "uxPostanskiBrojDataGridViewColumn";
			this.uxPostanskiBrojDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPostanskiBrojDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPostanskiBrojDataGridViewColumn.ReadOnly = false;		
			//
			// uxSifraOpcineDataGridViewColumn
			//
			this.uxSifraOpcineDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSifraOpcineDataGridViewColumn.DataPropertyName = "SifraOpcine";
			this.uxSifraOpcineDataGridViewColumn.HeaderText = "SifraOpcine";
			this.uxSifraOpcineDataGridViewColumn.Name = "uxSifraOpcineDataGridViewColumn";
			this.uxSifraOpcineDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSifraOpcineDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSifraOpcineDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrirezDataGridViewColumn
			//
			this.uxPrirezDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrirezDataGridViewColumn.DataPropertyName = "Prirez";
			this.uxPrirezDataGridViewColumn.HeaderText = "Prirez";
			this.uxPrirezDataGridViewColumn.Name = "uxPrirezDataGridViewColumn";
			this.uxPrirezDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrirezDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrirezDataGridViewColumn.ReadOnly = false;		
			//
			// uxZiroRacunZaPorezPrirezDataGridViewColumn
			//
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.DataPropertyName = "ZiroRacunZaPorezPrirez";
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.HeaderText = "ZiroRacunZaPorezPrirez";
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.Name = "uxZiroRacunZaPorezPrirezDataGridViewColumn";
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxZiroRacunZaPorezPrirezDataGridViewColumn.ReadOnly = false;		
			//
			// uxTipMjestaDataGridViewColumn
			//
			this.uxTipMjestaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTipMjestaDataGridViewColumn.DataPropertyName = "TipMjesta";
			this.uxTipMjestaDataGridViewColumn.HeaderText = "TipMjesta";
			this.uxTipMjestaDataGridViewColumn.Name = "uxTipMjestaDataGridViewColumn";
			this.uxTipMjestaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTipMjestaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTipMjestaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDNadMjestoDataGridViewColumn
			//
			this.uxIDNadMjestoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDNadMjestoDataGridViewColumn.DataPropertyName = "IDNadMjesto";
			this.uxIDNadMjestoDataGridViewColumn.HeaderText = "IDNadMjesto";
			this.uxIDNadMjestoDataGridViewColumn.Name = "uxIDNadMjestoDataGridViewColumn";
			this.uxIDNadMjestoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDNadMjestoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDNadMjestoDataGridViewColumn.ReadOnly = false;		
			//
			// uxHierarchyDataGridViewColumn
			//
			this.uxHierarchyDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHierarchyDataGridViewColumn.DataPropertyName = "Hierarchy";
			this.uxHierarchyDataGridViewColumn.HeaderText = "Hierarchy";
			this.uxHierarchyDataGridViewColumn.Name = "uxHierarchyDataGridViewColumn";
			this.uxHierarchyDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHierarchyDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHierarchyDataGridViewColumn.ReadOnly = false;		
			//
			// uxLvlDataGridViewColumn
			//
			this.uxLvlDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxLvlDataGridViewColumn.DataPropertyName = "Lvl";
			this.uxLvlDataGridViewColumn.HeaderText = "Lvl";
			this.uxLvlDataGridViewColumn.Name = "uxLvlDataGridViewColumn";
			this.uxLvlDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxLvlDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxLvlDataGridViewColumn.ReadOnly = false;		
			//
			// uxSifraOpcineRegosDataGridViewColumn
			//
			this.uxSifraOpcineRegosDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSifraOpcineRegosDataGridViewColumn.DataPropertyName = "SifraOpcineRegos";
			this.uxSifraOpcineRegosDataGridViewColumn.HeaderText = "SifraOpcineRegos";
			this.uxSifraOpcineRegosDataGridViewColumn.Name = "uxSifraOpcineRegosDataGridViewColumn";
			this.uxSifraOpcineRegosDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSifraOpcineRegosDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSifraOpcineRegosDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDNadMjestoDataGridViewColumn
			//				
			this.uxIDNadMjestoDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDNadMjestoDataGridViewColumn.ValueMember = "ID";	
			this.uxIDNadMjestoDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDNadMjestoDataGridViewColumn.DataSource = uxIDNadMjestoBindingSource;				
				
			//
			// uxTipMjestaDataGridViewColumn
			//				
			this.uxTipMjestaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxTipMjestaDataGridViewColumn.ValueMember = "ID";	
			this.uxTipMjestaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxTipMjestaDataGridViewColumn.DataSource = uxTipMjestaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxMjestoDataGridView);
			this.Name = "MjestoDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNadMjestoBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxTipMjestaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxMjestoBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				MjestoDataGridViewEventArgs args = new MjestoDataGridViewEventArgs();
				args.Mjesto = _currentMjesto;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class MjestoDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Mjesto	_Mjesto;
	
			/// <summary>
			/// the  Entities.Mjesto instance.
			/// </summary>
			public Entities.Mjesto Mjesto
			{
				get { return _Mjesto; }
				set { _Mjesto = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxMjestoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnMjestoDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxMjestoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnMjestoDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxMjestoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].ID;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].Naziv;
						break;
					case "uxPostanskiBrojDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].PostanskiBroj;
						break;
					case "uxSifraOpcineDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].SifraOpcine;
						break;
					case "uxPrirezDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].Prirez;
						break;
					case "uxZiroRacunZaPorezPrirezDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].ZiroRacunZaPorezPrirez;
						break;
					case "uxTipMjestaDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].TipMjesta;
						break;
					case "uxIDNadMjestoDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].IDNadMjesto;
						break;
					case "uxHierarchyDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].Hierarchy;
						break;
					case "uxLvlDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].Lvl;
						break;
					case "uxSifraOpcineRegosDataGridViewColumn":
						e.Value = MjestoList[e.RowIndex].SifraOpcineRegos;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxMjestoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnMjestoDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxMjestoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						MjestoList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						MjestoList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxPostanskiBrojDataGridViewColumn":
						MjestoList[e.RowIndex].PostanskiBroj = (System.Int32?)e.Value;
						break;
					case "uxSifraOpcineDataGridViewColumn":
						MjestoList[e.RowIndex].SifraOpcine = (System.Int32?)e.Value;
						break;
					case "uxPrirezDataGridViewColumn":
						MjestoList[e.RowIndex].Prirez = (System.Single?)e.Value;
						break;
					case "uxZiroRacunZaPorezPrirezDataGridViewColumn":
						MjestoList[e.RowIndex].ZiroRacunZaPorezPrirez = (System.String)e.Value;
						break;
					case "uxTipMjestaDataGridViewColumn":
						MjestoList[e.RowIndex].TipMjesta = (System.Int32?)e.Value;
						break;
					case "uxIDNadMjestoDataGridViewColumn":
						MjestoList[e.RowIndex].IDNadMjesto = (System.Int32?)e.Value;
						break;
					case "uxHierarchyDataGridViewColumn":
						MjestoList[e.RowIndex].Hierarchy = (System.String)e.Value;
						break;
					case "uxLvlDataGridViewColumn":
						MjestoList[e.RowIndex].Lvl = (System.Int32?)e.Value;
						break;
					case "uxSifraOpcineRegosDataGridViewColumn":
						MjestoList[e.RowIndex].SifraOpcineRegos = (System.String)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
